﻿using Caliburn.Micro;
using myapp.Databases.DAO;
using myapp.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace myapp.ViewModels
{
    /// <summary>
    /// Group of Possition
    /// </summary>
    public class PossitionGroupViewModel : BaseViewModel
    {
        #region Attribute

        private string _name;

        private PossitionGroupDetailViewModel _contentView;

        private PossitionGroupModel _possitionGroup;
        #endregion

        #region Properties
        /// <summary>
        /// Name of Group Possition
        /// </summary>
        public string Name
        {
            get { return _name; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    _name = value;
                    NotifyOfPropertyChange(() => Name);
                }
            }
        }

        /// <summary>
        /// Content View
        /// </summary>
        public PossitionGroupDetailViewModel ContentView
        {
            get
            {                
                return _contentView;
            }
            set
            {
                if (!value.Equals(null))
                {
                    _contentView = value;
                    NotifyOfPropertyChange(() => ContentView);
                }
            }
        }
        #endregion

        #region Constructure
        public PossitionGroupViewModel(PossitionGroupModel possitionGroup)
        {
            _possitionGroup = possitionGroup;
            Title = possitionGroup.Name;
            _contentView = new PossitionGroupDetailViewModel(possitionGroup.PossitionItems);
            _contentView.DisplayName = Title;

        }
        #endregion

        #region Method


        #endregion
    }
}
